<template>
  <div :style="{color:colorVal}">{{ count }}</div>
  <button @click="count++">count++</button>
  <!-- <button @click="$emit('changeColor')">修改颜色值</button> -->
  <button @click="changeColor">修改颜色值</button>
  <slot></slot>
</template>

<script setup>
  import { ref } from 'vue';
  const count = ref(1)
  // defineProps 声明了属性
  const props = defineProps(['colorVal']);
  const emits = defineEmits(['changeColor'])
  const changeColor = ()=>{
    emits('changeColor')
  }
</script>